import 'package:shared_preferences/shared_preferences.dart';
import 'dart:convert';
class Storage {
 static Future<bool> setSring(String key,String value) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.setString("userinfo", value);
    return true;
 }
 static Future<bool> setMap(String key,Map value) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    String mapString = json.encode(value);
    prs.setString("userinfo", mapString);
    return true;
 }

 static Future<bool> setInt(String key,int value) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.setInt("userinfo", value);
    return true;
 }
 static Future<bool> setBool(String key,bool value) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.setBool("userinfo", value);
    return true;
 }
 static Future<bool> setList(String key,List<String> value) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.setStringList("userinfo", value);
    return true;
 }
 static Future<String> getString(String key) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    return prs.getString(key);
 }
 static Future<Map> getMap(String key) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    return json.decode(prs.getString(key));
 }
 static Future<int> getInt(String key) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    return prs.getInt(key);
 }
 static Future<bool> getBool(String key) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    return prs.getBool(key);
 }
 static Future<bool> removkey(String key) async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.remove(key);
    return true;
 }
 static Future<bool> removeall() async{
    SharedPreferences prs = await SharedPreferences.getInstance();
    prs.clear();
    return true;
 }
}
